import Taro from "@tarojs/taro";

const globalData = {
  statusBarHeight:20,
  windowWidth:750,
}
const systemInfo=Taro.getSystemInfoSync()
const rectData=Taro.getMenuButtonBoundingClientRect()
// console.log({rectData,systemInfo})
setGlobalData('windowWidth',systemInfo.windowWidth)
setGlobalData('headerHeight',rectData.bottom+rectData.top-systemInfo.statusBarHeight*2)
setGlobalData('statusBarHeight',systemInfo.statusBarHeight)
setGlobalData('safeAreaBottom',systemInfo.screenHeight-systemInfo.safeArea.bottom)

export function setGlobalData (key, val) {
  globalData[key] = val
}
export function getGlobalData (key) {
  return globalData[key]
}